<?php   // $Id: etape_finale.php 347 2012-05-07 09:11:55Z pcoustillas $ ?>
<?php  
/*
Copyright (C) 2003-2004 Guy Hendrickx
Licensed under the terms of the GNU  General Public License:http://www.opensource.org/licenses/gpl-license.php
File Authors:Guy Hendrickx
*/

require_once("../include/utils.php");

if (get_magic_quotes_gpc() == 0) {
    function stripslashes_gpc(&$value)
    {
        $value = mysql_escape_string($value);
    }
    array_walk_recursive($_GET, 'stripslashes_gpc');
    array_walk_recursive($_POST, 'stripslashes_gpc');
    array_walk_recursive($_COOKIE, 'stripslashes_gpc');
    array_walk_recursive($_REQUEST, 'stripslashes_gpc');
}


?>
<link rel='stylesheet' type='text/css' href='../include/themes/bleu_clair/style.css'>
<link rel="shortcut icon" type="image/x-icon" href="../image/favicon.ico" >
<table width="100%" border="1" cellpadding="0" cellspacing="0" summary="">
	<tr>
		<td class ="install">
			<img src="../image/factux.gif" alt="">
		</td>
		<td>

			<?php  

			require_once("../include/config/common.php");
			$login2=isset($_POST['login2'])?$_POST['login2']:"";
			$pass=isset($_POST['pass'])?$_POST['pass']:"";
			$nom=isset($_POST['nom'])?$_POST['nom']:"";
			$prenom=isset($_POST['prenom'])?$_POST['prenom']:"";
			$mail=isset($_POST['mail'])?$_POST['mail']:"";
			$pass2=isset($_POST['pass2'])?$_POST['pass2']:"";

			$erreur=0;


			if($login2=='' || $pass==''|| $nom=='' || $prenom=='' || $mail=='' )
			{
				echo "<h1>" . get_lang("Vous avez oublié de remplir un champ !!!") . "</h1>";
				$erreur+=1;
			}
			
			if ($pass != $pass2)
			{
				echo "<h1>" . get_lang("Erreur, les deux mots de passe ne correspondent pas") . "</h1>";
				echo "<input type='button' onclick='history.back()' value='" . get_lang("Revenir à la page précédente") . "</input>";
				$erreur+=1;
			} else {
				$pass_crypt = md5($pass);
			}

			if ($erreur == 0)
			{

				mysql_select_db($db) or die ("Could not select $db database");
				$sql7 = "INSERT INTO " . $tblpref ."user (login, pwd, nom, prenom, email, dev, com, fact, admin, dep, stat, art, cli) VALUES ('$login2', '$pass_crypt', '$nom', '$prenom', '$mail', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y')";
				mysql_query($sql7) or die('Erreur SQL !<br>'.$sql7.'<br>'.mysql_error());
				echo " <br><br><center><h2>$prenom $nom est maintenant enregistré et a comme login : $login2 mot de passe : $pass .<br>";

			?>
				<br>
				<div style="background-color: #93C4D7;font-size:MEDIUM;color:green;font-weight: bold;text-align:center;">
					<?php aff_lang("La configuration d'OpenDCF est terminée, félicitations.") ?>
				</div>
				<br>
				<h2><?php aff_lang("Entrez dans") ?><a href="../index.php"> OpenDCF</a> 
			
			<?php
			}
			
			?>

		</td>
	</tr>

</table>

</body>

</html>

